package com.usian.day02.controller;

import com.usian.common.model.day01.User;
import com.usian.common.vo.ResultResopnse;
import com.usian.day02.fegin.UserFeginService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * @author baimugudu
 * @email 2415621370@qq.com
 * @date 2023/7/26 14:10
 */
@RestController
public class UserController {

    @Autowired
    UserFeginService userFeginService;

    @RequestMapping("/user/list")
    public ResultResopnse list(){
        ResultResopnse list = userFeginService.list();
        return list;
    }

    @GetMapping("/user/{id}")
    public ResultResopnse findById(@PathVariable String id){
        return userFeginService.findById(id);
    }

    @PostMapping("/user/save")
    public ResultResopnse save(@RequestBody User user){
        return userFeginService.savUser(user);
    }
}
